export default function getStackBarChart(optionSet = []) {
  optionSet = [
    {
      category: ['周一', '周二', '周三', '周四', '周五'],
      data: [
        {
          data: [320, 332, 301, 334, 390],
          markLine: '',
          name: '直接访问'
        }
      ]
    },
    {
      category: ['周一', '周二', '周三', '周四', '周五'],
      data: [
        {
          data: [620, 732, 701, 734, 1090],
          markLine: '',
          name: '邮件营销'
        }
      ]
    },
    {
      category: ['周一', '周二', '周三', '周四', '周五'],
      data: [
        {
          data: [120, 132, 101, 134, 90],
          markLine: '',
          name: '联盟广告'
        }
      ]
    },
    {
      category: ['周一', '周二', '周三', '周四', '周五'],
      data: [
        {
          data: [120, 132, 101, 134, 290],
          markLine: '',
          name: '视频广告'
        }
      ]
    },
    {
      category: ['周一', '周二', '周三', '周四', '周五'],
      data: [
        {
          data: [220, 182, 191, 234, 290],
          markLine: '',
          name: '搜索引擎'
        }
      ]
    }
  ];

  const option = {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'line'
      }
    },
    legend: {
      data: optionSet.map(item => item.data[0].name)
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: [
      {
        type: 'category',
        data: optionSet.length > 0 ? optionSet[0].category : []
      }
    ],
    yAxis: [
      {
        type: 'value'
      }
    ],
    series: optionSet.map(item => {
      item.data[0].type = 'bar';
      return item.data[0];
    })
  };

  return option;
}
